package com.android.projectsquirrel;

import android.app.Activity;
import android.content.*;
import android.location.*;
import android.os.Bundle;
import android.widget.Toast;

public class History extends Activity {

	public void onCreate(Bundle savedInstance) {
		super.onCreate(savedInstance);
		setContentView(R.layout.history);
		LocationManager locationManager = 
			(LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
		LocationListener locationListener = new CustomLocationListener();
		locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,locationListener);
		
	}
	
	
	
	public class CustomLocationListener implements LocationListener {
		
		@Override
		public void onLocationChanged(Location location) {
			//Update the String class
			location.getLatitude();
			location.getLongitude();
			String lat = "Latitude " + location.getLatitude() + "\n";
			lat = lat + "Longitude " + location.getLongitude();
			Toast.makeText(getApplicationContext(), lat, 
					Toast.LENGTH_LONG).show();
			
		}
		
		@Override
		public void onProviderDisabled(String provider ){
			Toast.makeText(getApplicationContext(), "GPS Disabled", 
					Toast.LENGTH_SHORT).show();
			
			
			
		}
		@Override
		public void onProviderEnabled(String provider) {
			Toast.makeText(getApplicationContext(), "GPS Enabled", 
					Toast.LENGTH_SHORT).show();
			
		}
		@Override
		public void onStatusChanged(String provider, int status, Bundle extras) {
			//Do nothing
		}
	}
	
	
	
}

















